#ifndef STATEMANAGER_H_INCLUDED
#define STATEMANAGER_H_INCLUDED

#include <vector>
#include <OIS.h>
#include "gcore.h"
#include "InputManager.h"

class State;

class StateManager : public gcore::Singleton<StateManager>, public OIS::MouseListener,
		public OIS::KeyListener, public OIS::JoyStickListener
{
public:
    StateManager();
	~StateManager();
	void start(State* state);
	void changeState(State* state);
	void pushState(State* state);
	void popState();
	static StateManager& getSingleton(void);
	static StateManager* getSingletonPtr(void);

	State* GetState();

protected:

	//Managers
	InputManager* mInputManager;
	//ObjectManager* mObjectManager;
	//SoundManager* mSoundManager;
	//NetworkManager* mNetworkManager;
	RenderCore *renderCore;

	//Input
	bool keyPressed( const OIS::KeyEvent &e );
	bool keyReleased( const OIS::KeyEvent &e );
	bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
	bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );
	bool mouseMoved( const OIS::MouseEvent &e );
	bool axisMoved( const OIS::JoyStickEvent &e, int val);
	bool buttonPressed( const OIS::JoyStickEvent &e, int val);
	bool buttonReleased( const OIS::JoyStickEvent &e, int val);

private:
	std::vector<State*> mStates;
};

#endif // STATEMANAGER_H_INCLUDED
